<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <title>外带设备详情</title>
    <link rel="stylesheet" href="/asset/layui/css/layui.css">
    <link rel="stylesheet" href="/asset/css/index.css">
    <script src="/asset/layui/layui.js"></script>
    <link rel="Shortcut Icon" href="cachet.ico">
    
</head>
<body >
<div class="">
<form class="layui-form">
	<input type="hidden" name="devicesActId" value="${devicesAct.devicesActId}">
       <div class="layui-tab layui-tab-brief" lay-filter="docDemoTabBrief">
                <ul class="layui-tab-title">
                    <li class="layui-this">申请信息</li>
                    <li>使用信息</li>
、                </ul>
                <div class="layui-tab-content">
                	<!--tb1-->
                    <div class="layui-tab-item layui-show">
                    	<div class="layui-form-item">
						    <div class="layui-inline">
						      <label class="layui-form-label">申请印章</label>
						      <div class="layui-input-inline layui-form-mid layui-word-aux">
						      	${apply.seal.sealName}
						      </div>
						    </div>
						    <div class="layui-inline">
						      <label class="layui-form-label">申请时间</label>
						      <div class="layui-input-inline layui-form-mid layui-word-aux">
						      	${apply.applyTime?string("yyyy-MM-dd HH:mm:ss")}
						      </div>
						    </div>
						</div>
						<div class="layui-form-item">
						    <div class="layui-inline">
						      <label class="layui-form-label">申请类型</label>
						      <div class="layui-input-inline layui-form-mid layui-word-aux">
						      	<@linkage type="APPLY_TYPE" key=apply.applyType>
					        		<span class="${linkage.style}">${linkage.name}</span>
					        	</@linkage>
						      </div>
						    </div>
						    <div class="layui-inline">
						      <label class="layui-form-label">申请状态</label>
						      <div class="layui-input-inline layui-form-mid layui-word-aux">
						      	
						      	<@linkage type="APPLY_STATUS" key=apply.applyStatus>
					        		<span class="${linkage.style}">${linkage.name}</span>
					        	</@linkage>
						      </div>
						    </div>
						</div>
						
						<div class="layui-form-item">
							<div class="layui-inline">
						      <label class="layui-form-label">申请人</label>
						      <div class="layui-input-inline layui-form-mid layui-word-aux">
						      	${apply.person.name}
						      </div>
						    </div>
						    <div class="layui-inline">
						      <label class="layui-form-label">申请次数</label>
						      <div class="layui-input-inline layui-form-mid layui-word-aux">
						      	${apply.applyTimes} 次
						      </div>
						    </div>
						</div>
						<div class="layui-form-item">
						    <div class="layui-inline">
						      <label class="layui-form-label">申请事由</label>
						      <div class="layui-input-inline layui-form-mid layui-word-aux">
						      	${apply.cause}
						      </div>
						    </div>
						</div>
						
						<div class="layui-form-item">
						    <div class="layui-inline">
						      <label class="layui-form-label">申请凭证</label>
						      <div class="layui-input-inline" style="width:500px">
							    <table class="layui-table">
							      <thead>
							          <tr>
								        <th>文件名</th>
								        <th>操作</th>
								      </tr>
							      </thead>
							      <tbody>
							      		<#if applyFiles?? && applyFiles?size gt 0>
							      		<#list applyFiles as item>
							      		<tr>
							      			<td>${item.fileName}</td>
							      			<td><a href="${item.fileUrl}" target="_blank" class="layui-btn layui-btn-xs layui-btn-warm">查看</a></td>
							      		</tr>
							      		</#list>
							      		<#else>
							      		<tr>
							      			<td colspan=2 style="text-align:center">暂无附件</td>
							      		</tr>
							      		</#if>
							      </tbody>
							    </table>
							    </div>
						    </div>
						</div>
						<!----审核信息---->
						<div class="layui-form-item">
						    <div class="layui-inline">
						      <label class="layui-form-label">审核情况</label>
						      <div class="layui-input-block">
						      	<ul class="layui-timeline">
						      	
							      	  <li class="layui-timeline-item">
									    <i class="layui-icon layui-timeline-axis"></i>
									    <div class="layui-timeline-content layui-text">
									      <div class="layui-timeline-title">${apply.applyTime?string("yyyy-MM-dd HH:mm:ss")}，${apply.person.name}发启申请</div>
									    </div>
									  </li>
						      	
							      	 <#if apply.applyType=="TEST_APPLY" || apply.applyType=="URGENT_APPLY">
							      	  <li class="layui-timeline-item">
									    <i class="layui-icon layui-timeline-axis"></i>
									    <div class="layui-timeline-content layui-text">
									      <div class="layui-timeline-title">${apply.applyTime?string("yyyy-MM-dd HH:mm:ss")}，系统审核通过</div>
									    </div>
									  </li>
							      	 <#else>
								      	 <#list verifys as item>
										  <li class="layui-timeline-item">
										    <i class="layui-icon layui-timeline-axis"></i>
										    <div class="layui-timeline-content layui-text">
										      <div class="layui-timeline-title">
										      	${item.verifyTime?string("yyyy-MM-dd HH:mm:ss")}，${item.person.name} <#if item.verifyStatus=="PASSED">审核通过<#elseif item.verifyStatus=="REJECT">拒绝通过</#if>
										      </div>
										    </div>
										  </li>
										  </#list>
							      	 </#if>
								</ul>
						      </div>
						    </div>
						</div>
						<!-------------->
                    
                    </div>
                    <!--tb1-->
                    
					<!--tb3-->
                    <div class="layui-tab-item">
            			<div class="layui-form-item">
	                        <fieldset class="layui-elem-field layui-field-title">
							    <legend style="font-size:14px">使用凭证</legend>
							</fieldset>
	                        <table class="layui-table mytable" lay-even="" lay-skin="nob">
				                <thead>
				                    <tr>
				                        <th>上传时间</th>
				                        <th>凭证证明</th>
				                    </tr>
				                </thead>
				                <tbody>
				                	<#list usedCerts as item>
				                    <tr>
				                        <td>${item.createTime?string("yyyy-MM-dd HH:mm:ss")}</td>
				                        <td>
				                        	<#list item.upfiles as item>
				                        	<img src="${item.fileUrl}" style="width:60px">
				                        	</#list>
				                        </td> 
				                    </tr>
				                    </#list>
				                </tbody>
				            </table>
	                        
	                        <fieldset class="layui-elem-field layui-field-title" style="clear: both;">
							    <legend style="font-size:14px">使用记录</legend>
							</fieldset>
						    <table class="layui-table mytable" lay-even="" lay-skin="nob">
	                            <thead>
		                            <tr>
		                                <th>使用时间</th>
		                                <th>设备名称/编号</th>
		                                <th>使用状态</th>
		                            </tr>
	                            </thead>
	                            <tbody>
	                            	<#list useds as item>
		                            <tr>
		                            	<td>${item.usedTime?string('yyyy-MM-dd HH:mm:ss')}</td>
		                                <td>${item.seal.sealName}[${item.devices.devicesCode}]</td>
		                                <td>
		                                	<@linkage type="USED_STATUS" key=item.usedStatus>
								        		<span class="${linkage.style}">${linkage.name}</span>
								        	</@linkage>
		                                </td>
		                            </tr>
		                            </#list>
	                            </tbody>
	                        </table>
						</div>
                    </div>
                    <!--tb3-->
                    
        </div>

		<div style="position:fixed; bottom:0;text-align: center;padding: 20px; width: 800px;background-color: #f1f1f1;">
			
			<#if devicesAct.censorStatus =='WAIT'>
        		<button class="layui-btn" lay-submit="" lay-filter="add">确认核查</button>
        	</#if>
        	
        	<#if devicesAct.censorStatus =='CHECKED'>
        		<button class="layui-btn layui-btn-sm layui-btn-disabled">已核查</button>
        	</#if>
			
			
		</div>
		
		
		
		
		
		
</form>
</div>
<script>
layui.use(['element','laydate','upload','form'], function(){
	  var $ = layui.jquery,element = layui.element,laydate = layui.laydate,upload=layui.upload,form=layui.form; 
	  
	  
	  form.on('submit(add)', function(data){
            var field = data.field;
            $.ajax({
      			type:"POST", 
      			url:"/custos/actCensor.htm",
      			data:field,
      			success:function(result) {
		      
		      		if(result.code=='1'){
		      			layer.alert("操作成功", {icon: 6},function () {
			                // 获得frame索引
			                 window.parent.location.reload();
			                var index = parent.layer.getFrameIndex(window.name);
			                //关闭当前frame
			                parent.layer.close(index);
			            });
		      		}else{
		      		 	layer.msg(result.msg);
		      		}
		      
		    	 } 
		    });
            
            return false;
          });
	  
	  
	  
	  upload.render({
    elem: '#upload'
    ,url: '/upload/fileupload.htm?module=cert'
    
    ,done: function(res, index, upload){
      var devicesId = this.devicesId;
      var devicesActId = this.devicesActId;
      console.log(res);
      if(res.code == 1){
      		
      		var field = {
      			devicesId:devicesId,
      			devicesActId:devicesActId
      		}
      		field['upfiles[0].upfileId'] = res.data.upfileId;
          	field['upfiles[0].fileUrl'] = res.data.filepath;
      		
      		$.ajax({
      			type:"POST", 
      			url:"/devices/upcert.htm",
      			data:field,
      			success:function(result) {
		      
		      		if(result.code=='1'){
		      			layer.msg("上传成功");
		      			location.reload();
		      		}else{
		      		 	layer.msg(result.msg);
		      		}
		      
		    	 	} 
		    }); 
      	
      
      }
      
    }
  })
	  
	  
	  
});
</script>
</body>
</html>